;(function(){
    $.ajax({
      url: "data/data1.json", //json文件位置
      type: "get",
      dataType: "json", //返回数据格式为json
      success: function (data) { //请求成功完成后要执行的方法
          console.log(data);
          var chartDom = document.getElementById('main1');
          var myChart = echarts.init(chartDom,'dark');
          // var myChart = echarts.init(chartDom);
          var option;
          
          setTimeout(function () {
            option = { 
			  title: {
			  text: '学生就业率',
			  left: '8%'
			},
              background:'',
              legend: {},
              tooltip: {
                trigger: 'axis',
                showContent: false
              },
              dataset: {
                source: [
                 data.x,
                 data.item1,
                 data.item2,
                 data.item3,
                 data.item4,
                 data.item5,
                 data.item6,
                ]
              },
              xAxis: { type: 'category' },
              yAxis: { gridIndex: 0 },
              grid: { top: '55%' },
              series: [
                {
                  type: 'line',
                  smooth: true,
                  seriesLayoutBy: 'row',
                  emphasis: { focus: 'series' }
                },
                {
                  type: 'line',
                  smooth: true,
                  seriesLayoutBy: 'row',
                  emphasis: { focus: 'series' }
                },
                {
                  type: 'line',
                  smooth: true,
                  seriesLayoutBy: 'row',
                  emphasis: { focus: 'series' }
                },
                {
                  type: 'line',
                  smooth: true,
                  seriesLayoutBy: 'row',
                  emphasis: { focus: 'series' }
                },
                {
                  type: 'line',
                  smooth: true,
                  seriesLayoutBy: 'row',
                  emphasis: { focus: 'series' }
                },
                {
                  type: 'line',
                  smooth: true,
                  seriesLayoutBy: 'row',
                  emphasis: { focus: 'series' }
                },
                {
                  type: 'pie',
                  id: 'pie',
                  radius: '30%',
                  center: ['50%', '25%'],
                  emphasis: {
                    focus: 'self'
                  },
                  label: {
                    formatter: '{b}: {@2017} ({d}%)'
                  },
                  encode: {
                    itemName: 'product',
                    value: '2017',
                    tooltip: '2017'
                  }
                }
              ]
            };
            myChart.on('updateAxisPointer', function (event) {
              const xAxisInfo = event.axesInfo[0];
              if (xAxisInfo) {
                const dimension = xAxisInfo.value + 1;
                myChart.setOption({
                  series: {
                    id: 'pie',
                    label: {
                      formatter: '{b}: {@[' + dimension + ']} ({d}%)'
                    },
                    encode: {
                      value: dimension,
                      tooltip: dimension
                    }
                  }
                });
              }
            });
            myChart.setOption(option);
          });
          
          option && myChart.setOption(option);
          window.onresize = myChart.resize;
      }

  
   
  })


})();